/*
*  Copyright 2019-2023 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.poemmanager.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

/**
*  @description /
* @author hwl
* @date 2024-12-06
**/
@Data
@TableName("poem")
public class Poem implements Serializable {

    @TableId(value = "poem_id")
    @ApiModelProperty(value = "主键")
    private Integer poemId;

    @ApiModelProperty(value = "标题")
    private String title;

    @ApiModelProperty(value = "作者id（用户的id或者作者的id）")
    private Integer authorId;

    @ApiModelProperty(value = "朝代")
    private String dynasty;


    @ApiModelProperty(value = "主体内容")
    private String content;

    @ApiModelProperty(value = "创造时间")
    private Timestamp createdAt;

    @ApiModelProperty(value = "更新时间")
    private Timestamp updatedAt;


    @ApiModelProperty(value = "作者姓名")
    private Integer author_name;
    @ApiModelProperty(value = "评论数")
    private List<Comment> comments;
    @ApiModelProperty(value = "评论数")
    private Integer commentCount;

    @ApiModelProperty(value = "收藏数")
    private Integer favoriteCount;

    @ApiModelProperty(value = "副标题")
    private String subTitle;

    @ApiModelProperty(value = "用户名")
    private String authorName;

    @ApiModelProperty(value = "点赞数")
    private Integer likeCount;


    public void copy(Poem source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
